import instance from "./require";
import type { shopTS, typeTS } from "../store/crmsTS";

//商品数据列表
export let http_getShoplist = (): Promise<Array<shopTS>> => {
    return instance.get('/shoplist1')
}

//分类数据列表
export let http_getTypelist = (): Promise<Array<typeTS>> => {
    return instance.get('/typelist1')
}

//添加商品列表数据
export let http_addShoplist = (obj: shopTS): Promise<shopTS> => {
    return instance.post(`/shoplist1`, obj)
}

//编辑商品列表数据
export let http_editShoplist = (obj: shopTS): Promise<shopTS> => {
    return instance.patch(`/shoplist1/${obj.id}`, obj)
}

//删除商品列表数据
export let http_delShoplist = (id: number) => {
    return instance.delete(`/shoplist1/${id}`)
}

//搜索商品列表数据
export let http_searchShoplist = (title: string): Promise<Array<shopTS>> => {
    return instance.get('/shoplist1', { params: { 'title_like': title } })
}